﻿using GalaSoft.MvvmLight;
using KPI.Comm;
using KPI.Entity;
using KPI.UIBase;
using System;
using System.Collections.ObjectModel;
using System.Linq;
using TYBase;

namespace KPIClient.Views
{
    public class ViewQuestionNaireListModel : ViewModelBase
    {
        public ViewQuestionNaireListModel()
        {
            ListStatus.Add(IntStringData.GetAll());
            ListStatus.Add(IntStringData.New((int)EnumExamStatus.NotPublish, EnumHelper.ExamStausAsString((int)EnumExamStatus.NotPublish)));
            ListStatus.Add(IntStringData.New((int)EnumExamStatus.Publish, EnumHelper.ExamStausAsString((int)EnumExamStatus.Publish)));
            ListStatus.Add(IntStringData.New((int)EnumExamStatus.Finish, EnumHelper.ExamStausAsString((int)EnumExamStatus.Finish)));
            SelectedStatus = ListStatus.FirstOrDefault();
        }
        private ObservableCollection<QuestionNaireModel> _ListQuestionNaire = new ObservableCollection<QuestionNaireModel>();
        public ObservableCollection<QuestionNaireModel> ListQuestionNaire { get { return _ListQuestionNaire; } set { Set("ListQuestionNaire", ref _ListQuestionNaire, value); } }

        private DateTime? _DtStart;
        public DateTime? DtStart { get => _DtStart; set => Set("DtStart", ref _DtStart, value); }

        private DateTime? _DtEnd;
        public DateTime? DtEnd { get => _DtEnd; set => Set("DtEnd", ref _DtEnd, value); }

        private string _Name;
        public string Name { get => _Name; set => Set("Name", ref _Name, value); }

        private ObservableCollection<IntStringData> _ListStatus = new ObservableCollection<IntStringData>();
        public ObservableCollection<IntStringData> ListStatus { get { return _ListStatus; } set { Set("ListStatus", ref _ListStatus, value); } }

        private IntStringData _SelectedStatus;
        public IntStringData SelectedStatus { get => _SelectedStatus; set => Set("SelectedStatus", ref _SelectedStatus, value); }





    }

    public class QuestionNaireModel : VMBase
    {
        private string _Title;

        public ExamRecordVO Data { get; private set; }
        public string Title { get => _Title; set => Set("Title", ref _Title, value); }

        private string _StatusStr;
        public string StatusStr { get => _StatusStr; set => Set("StatusStr", ref _StatusStr, value); }

        private int _Status;
        public int Status { get => _Status; set => Set("Status", ref _Status, value); }

        private string _CreatorName;
        public string CreatorName { get => _CreatorName; set => Set("CreatorName", ref _CreatorName, value); }

        private string _Tag;
        public string Tag { get => _Tag; set => Set("Tag", ref _Tag, value); }





        public void FromData(ExamRecordVO vo)
        {
            Data = vo;
            Title = vo.title;
            CreateTime = vo.createTime.NullAsTimeStr();
            StatusStr = EnumHelper.ExamStausAsString(vo.status);
            Status = vo.status;
            CreatorName = vo.creatorName;

        }

        private string _CreateTime;
        public string CreateTime { get => _CreateTime; set => Set("CreateTime", ref _CreateTime, value); }


    }
}
